package com.example.hand.springbootweb.app.service;

import com.example.hand.springbootweb.domain.entity.LoginJPA;
import com.example.hand.springbootweb.domain.vo.LoginVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface LoginUser extends JpaRepository<LoginJPA,Integer> {

    //原生sql语句，使用nativeQuery =true
//    @Query("from LoginJPA where userName= ?1 and password= ?2")
//    LoginJPA selectLoginUser(String username,String password);

    @Query("from LoginJPA where userName= :username and password= :password")
    LoginJPA selectLoginUser(@Param("username") String username,@Param("password") String password);


    @Query("from LoginJPA")
    List<LoginJPA> selectAll();


}
